import request from '@/utils/request'

// 营业时间相关接口
export function getBusinessHoursList() {
  return request({
    url: '/api/settings/business-hours/list',
    method: 'get'
  })
}

export function addBusinessHours(data) {
  return request({
    url: '/api/settings/business-hours',
    method: 'post',
    data
  })
}

export function updateBusinessHours(data) {
  return request({
    url: '/api/settings/business-hours',
    method: 'put',
    data
  })
}

export function deleteBusinessHours(id) {
  return request({
    url: `/api/settings/business-hours/${id}`,
    method: 'delete'
  })
}

// 配送配置相关接口
export function getDeliveryConfigList() {
  return request({
    url: '/api/settings/delivery-config/list',
    method: 'get'
  })
}

export function addDeliveryConfig(data) {
  return request({
    url: '/api/settings/delivery-config',
    method: 'post',
    data
  })
}

export function updateDeliveryConfig(data) {
  return request({
    url: '/api/settings/delivery-config',
    method: 'put',
    data
  })
}

export function deleteDeliveryConfig(id) {
  return request({
    url: `/api/settings/delivery-config/${id}`,
    method: 'delete'
  })
}

// 优惠券相关接口
export function getCouponList() {
  return request({
    url: '/api/settings/coupon/list',
    method: 'get'
  })
}

export function addCoupon(data) {
  return request({
    url: '/api/settings/coupon',
    method: 'post',
    data
  })
}

export function updateCoupon(data) {
  return request({
    url: '/api/settings/coupon',
    method: 'put',
    data
  })
}

export function deleteCoupon(id) {
  return request({
    url: `/api/settings/coupon/${id}`,
    method: 'delete'
  })
}

// 促销活动相关接口
export function getPromotionList() {
  return request({
    url: '/api/settings/promotion/list',
    method: 'get'
  })
}

export function addPromotion(data) {
  return request({
    url: '/api/settings/promotion',
    method: 'post',
    data
  })
}

export function updatePromotion(data) {
  return request({
    url: '/api/settings/promotion',
    method: 'put',
    data
  })
}

export function deletePromotion(id) {
  return request({
    url: `/api/settings/promotion/${id}`,
    method: 'delete'
  })
}

// 通知相关接口
export function getNoticeList() {
  return request({
    url: '/api/settings/notice/list',
    method: 'get'
  })
}

export function addNotice(data) {
  return request({
    url: '/api/settings/notice',
    method: 'post',
    data
  })
}

export function updateNotice(data) {
  return request({
    url: '/api/settings/notice',
    method: 'put',
    data
  })
}

export function deleteNotice(id) {
  return request({
    url: `/api/settings/notice/${id}`,
    method: 'delete'
  })
}

export function toggleNoticeStatus(id, status) {
  return request({
    url: `/api/settings/notice/${id}/status`,
    method: 'put',
    params: { status }
  })
}